package leecode

import "sort"

func countElements(nums []int) int {
	sort.Ints(nums)
	maxNum := nums[len(nums)-1]
	minNum := nums[0]
	var result int
	for i := 0; i < len(nums); i++ {
		if nums[i] != minNum && nums[i] != maxNum {
			result++
		}
	}
	return result
}
